package farm.pattern.chain;


import farm.entity.EnvironmentData;
import farm.entity.FarmMachine;

public class ObstacleHandler extends SafetyHandler {
    @Override
    public void handleRequest(EnvironmentData data, FarmMachine machine) {
        if (data.isHasObstacle()) {
            System.out.println(machine.getType() + " 检测到障碍物，尝试紧急避障");
        }
        if (nextHandler != null) {
            nextHandler.handleRequest(data, machine);
        }
    }
}